package org.yx.service.sres.view_device_resource;

import org.dbist.dml.Page;
import org.dbist.dml.Query;
import org.yx.utils.BaseService;

/**
 * 查询设备资源台账
 * @author zxw
 * @since 2019/06/12
**/
public class SresViewDeviceResourceService extends BaseService {
	public SresViewDeviceResourceOut viewDeviceResource(SresViewDeviceResourceIn in) throws Exception {
		Query query = new Query(in.getPageIndex(), in.getPageSize());
		query.addFilter("orgCode", in.getUserOrgCode());
		query.addFilter("resId", in.getResId());
		query.addFilter("resType", in.getResType());

		Page<DeviceResource> pageRes = selectPageBySqlFilePath("select_device_resource.sql", query,
				DeviceResource.class);
		
		SresViewDeviceResourceOut out = new SresViewDeviceResourceOut();
		out.setResList(pageRes.getList());
		out.setTotal(pageRes.getTotalSize());

		return out;
	}
}